package org.lzfto.flink.demo.config.mqtt;
/**
*自定义mqtt消息封装类
*@author lzfto
*@创建时间 2025年6月17日 13:22:14
*/
public class CustomMqttMessage<T> {
	/*
	 * 消息类型-常规，表示数据
	 */
	public static int MQTT_MESSAGE_TYPE_NORMAL=0;
	/*
	 * 消息类型-开始标记
	 */
	public static int MQTT_MESSAGE_TYPE_START=1;
	/*
	 * 消息类型-结束标记
	 */
	public static int MQTT_MESSAGE_TYPE_END=2;
	
	private Integer flag;
	/**
	 * 业务类型
	 */
	private String businessType;
	private T data;
	
	public CustomMqttMessage() {
	}
	
	public CustomMqttMessage(Integer flag, String businessType, T data) {
		this.flag = flag;
		this.businessType = businessType;
		this.data = data;
	}
	
	public static <P> CustomMqttMessage<P> buildStart(){
		return new CustomMqttMessage<P>(MQTT_MESSAGE_TYPE_START,"通用",null);
	}
	
	public static <P> CustomMqttMessage<P> buildEnd(){
		return new CustomMqttMessage<P>(MQTT_MESSAGE_TYPE_END,"通用",null);
	}

	public String getBusinessType() {
		return businessType;
	}
	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}
	public Integer getFlag() {
		return flag;
	}
	public void setFlag(Integer flag) {
		this.flag = flag;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
	
}
